"""获取登录成功的令牌，拼接的请求头返回"""

# 定义函数
import requests


def get_header():
    url = "http://ihrm-java.itheima.net/api/sys/login"
    data = {"mobile": "13800000002", "password": "123456"}
    resp = requests.post(url=url, json=data)
    print(resp.json())
    # 从响应体获取data的值
    token = resp.json().get("data")
    header = {"Content-Type": "application/json",
              "Authorization": "Bearer" + token}
    return header


if __name__ == '__main__':
    get_header()
